package cn.chen.数据结构.二叉树;

/**
 * 测试二叉排序树类
 */
public class BinaryTreeTest {

    public static void main(String[] args){

        BinaryTree tree=new BinaryTree();
        tree.setRoot(new TreeNode(5,"chen5"));
        TreeNode root = tree.getRoot();
        tree.addNode(root,new TreeNode(3,"chen2"));
        tree.addNode(root,new TreeNode(51,"chen51"));
        tree.addNode(root,new TreeNode(1,"chen1"));
        tree.addNode(root,new TreeNode(96,"chen96"));
        tree.addNode(root,new TreeNode(4,"chen4"));
        tree.addNode(root,new TreeNode(2,"chen4"));

        // 前序遍历
//        tree.preOrder(root);

        TreeNode treeNode = tree.preSelect(root, 4);
        System.out.println(treeNode);

    }
}
